package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
	
	@Select("select * from category where name = #{name};")
	List<Category> getCategoryByName(String name);
	
	List<Category> getCategoryBy(String name, Integer type, Long... id);
	
	@AutoFill(OperationType.INSERT)
	Integer insert(Category category);
	
	@Delete("delete from category where id = #{id};")
	Integer deleteById(Long id);
	
	@AutoFill(OperationType.UPDATE)
	void update(Category category);
}
